package com.oj.judge;

import com.oj.judge.domain.JudgeContext;
import com.oj.judge.domain.JudgeResult;
import com.oj.judge.domain.Submission;
import com.oj.judge.strategy.JudgeStrategy;
import com.oj.judge.strategy.impl.DefaultJudgeStrategyImpl;
import com.oj.judge.strategy.impl.JavaJudgeStrategyImpl;

/**
 * @Classname JudgeManger
 * @Description TODO
 * @Date 2025/3/18 21:40
 * @Created by xxx
 */
public class JudgeManger {
    public JudgeResult doJudge(JudgeContext judgeContext) {
        Submission questionSubmit = judgeContext.getSubmission();
        String language = questionSubmit.getLanguage();
        JudgeStrategy judgeStrategy = new DefaultJudgeStrategyImpl();
        if ("java".equals(language)) {
            judgeStrategy = new JavaJudgeStrategyImpl();
        }
        return judgeStrategy.doJudge(judgeContext);
    }

}
